package org.miaosha.mapper;

import java.util.List;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.miaosha.model.GoodsInfoView;
import org.miaosha.model.GoodsInfoViewCriteria;

public interface GoodsInfoViewMapper {
    @SelectProvider(type=GoodsInfoViewSqlProvider.class, method="countByExample")
    long countByExample(GoodsInfoViewCriteria example);

    @DeleteProvider(type=GoodsInfoViewSqlProvider.class, method="deleteByExample")
    int deleteByExample(GoodsInfoViewCriteria example);

    @Insert({
        "insert into goods_info_view (id, goods_name, ",
        "goods_title, goods_img, ",
        "goods_price, goods_stock, ",
        "miaosha_price, stock_count, ",
        "start_date, end_date, ",
        "goods_detail)",
        "values (#{id,jdbcType=BIGINT}, #{goodsName,jdbcType=VARCHAR}, ",
        "#{goodsTitle,jdbcType=VARCHAR}, #{goodsImg,jdbcType=VARCHAR}, ",
        "#{goodsPrice,jdbcType=DECIMAL}, #{goodsStock,jdbcType=INTEGER}, ",
        "#{miaoshaPrice,jdbcType=DECIMAL}, #{stockCount,jdbcType=INTEGER}, ",
        "#{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}, ",
        "#{goodsDetail,jdbcType=LONGVARCHAR})"
    })
    int insert(GoodsInfoView record);

    @InsertProvider(type=GoodsInfoViewSqlProvider.class, method="insertSelective")
    int insertSelective(GoodsInfoView record);

    @SelectProvider(type=GoodsInfoViewSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_title", property="goodsTitle", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_img", property="goodsImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_price", property="goodsPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="goods_stock", property="goodsStock", jdbcType=JdbcType.INTEGER),
        @Result(column="miaosha_price", property="miaoshaPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER),
        @Result(column="start_date", property="startDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_date", property="endDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="goods_detail", property="goodsDetail", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<GoodsInfoView> selectByExampleWithBLOBs(GoodsInfoViewCriteria example);

    @SelectProvider(type=GoodsInfoViewSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_title", property="goodsTitle", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_img", property="goodsImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_price", property="goodsPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="goods_stock", property="goodsStock", jdbcType=JdbcType.INTEGER),
        @Result(column="miaosha_price", property="miaoshaPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER),
        @Result(column="start_date", property="startDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_date", property="endDate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<GoodsInfoView> selectByExample(GoodsInfoViewCriteria example);

    @UpdateProvider(type=GoodsInfoViewSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") GoodsInfoView record, @Param("example") GoodsInfoViewCriteria example);

    @UpdateProvider(type=GoodsInfoViewSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") GoodsInfoView record, @Param("example") GoodsInfoViewCriteria example);

    @UpdateProvider(type=GoodsInfoViewSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") GoodsInfoView record, @Param("example") GoodsInfoViewCriteria example);
}